/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Negocios;

/**
 *
 * @author Estudiante
 */
public class VectorEntero {
    private int n;

    public int getN() {
        return n;
    }

    public void setN(int n) {
        this.n = n;
    }
    
    private final int Max=1000;
    private Negocios.Entero[] V=new Entero[Max];
    
    public boolean Lleno(){
        return n==Max;
    }
    
    public boolean Insertar(Negocios.Entero ele){
        if(!this.Lleno()){
            V[n]=ele;
            n++;
            return true;
        }else
            return false;
    }
    
    public boolean Insertar(int ele){
        if(!this.Lleno()){
            Entero obj= new Entero();
            obj.setNum(ele);
            V[n]=obj;
            n++;
            return true;
        }else
            return false;
    }
    
    public Entero LeerVector(int posicion){
        return V[posicion];
    }
    
    public void Intercambiar(Entero a, Entero b){
        Entero aux = new Entero();
        aux.setNum(a.getNum());
        a.setNum(b.getNum());
        b.setNum(aux.getNum());
    }
    public void Ordenar(){
        for(int i=0;i<=n-2;i++){
            for(int j=i+1;j<=n-1;j++){
               if (V[j].getNum()<V[i].getNum()){
                   this.Intercambiar(V[i],V[j]);
               }     
            }
        }
    }
    
    public Boolean Existe(int ele){
        for(int i=0;i<=n-1;i++){
            if(V[i].getNum()==ele)
                return true;
        }
        return false;
    }
     public Boolean ExisteRepetido(int ele){
        int c=0;
         for(int i=0;i<=n-1;i++){
            if(V[i].getNum()==ele){
               c++;     
            }

        }
         if (c>0)
             return true;
         else
            return false;
    }
     
     public void EliminarPosicion(int p){
         VectorEntero v1= new VectorEntero();
        for(int i=0;i<=n-1;i++){
            if(i==p){
                                    
            }else{
                  v1.Insertar(V[i].getNum());              
            }
        }
        

     }
     
    public void EliminarRepetido(){
        VectorEntero v1= new VectorEntero();
        for(int i=0;i<=n-1;i++){
            if(ExisteRepetido(V[i].getNum())){
               v1.Insertar(V[i].getNum());                     
            }
        }
    }
}
